import axios from 'axios';

//创建axios实例
export const Service = axios.create({
  baseURL: 'http://localhost:8080',
  headers: {
    'Content-Type': "application/json;charset=UTF-8"
  },
  timeout: 3000
});

export const available = (payload) => {
  return Service.get('/available', { params: payload })
}

export const under = (payload) => {
  return Service.get('/under', { params: payload })
}

export const running = (payload) => {
  return Service.get('/running', { params: payload })
}

export const RouteArrange = (id) => {
  return Service.get('/routeArrange', { params: { id } })
}

export const updateRouteArrang = (form) => {
  return Service.put('/updateRouteArrang', form)
}

export const comeArrange = (id) => {
  return Service.put('/arrange', id)
}

export const ArrangeFix = (id) => {
  return Service.put('/fix', id)
}

export const getSafety = () => {
  return Service.get('/safety-accident')
}

export const getSafetys = () => {
  return Service.get('/safety-accidents')
}

export const addSafety = (safe) => {
  return Service.post('/addSafetyAccident', safe)
}

export const getAnnoucement = () => {
  return Service.get('/announcement')
}

export const getAnnoucements = () => {
  return Service.get('/announcements')
}

export const addAnnouncements = (form) => {
  return Service.post('/addAnnouncement', form)
}

export const GetAvatar = (id) => {
  return Service.get('/avatar', { params: { id } })
}